<?php

use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

/**
 * 用户信息表
 *
 * Date: 19/03/2018
 * @author George
 */
class CreateUsersTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('users', function (Blueprint $table) {
            $table->increments('id');
            $table->string('name')->nullable()->comment('姓名');
            $table->string('mobile')->unique()->comment('手机');
            $table->string('password')->comment('密码');
            $table->date('birthday')->nullable()->comment('生日');
            $table->string('gender')->default('')->comment('性别');
			$table->string('identification', 18)->nullable()->unique()->comment('身份证');
            $table->unsignedInteger('company_id')->default(0)->index()->comment('公司ID');
            $table->unsignedInteger('department_id')->default(0)->index()->comment('公司ID');
            $table->unsignedInteger('project_id')->default(0)->index()->comment('项目ID');
            $table->unsignedInteger('position_id')->default(0)->index()->comment('岗位ID');
            $table->string('avatar')->nullable()->comment('头像');
			$table->string('certificate')->nullable()->comment('保安证号');
			$table->boolean('manager')->default(0)->comment('管理者');
			$table->boolean('attendance_remind')->default(1)->comment('考勤提醒');
			$table->boolean('inspection_remind')->default(1)->comment('巡检提醒');
			$table->boolean('report_remind')->default(1)->comment('报岗提醒');
			$table->string('registration_id')->index()->default('')->comment('用户唯一ID');
            $table->timestamps();
            $table->softDeletes();
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('users');
    }
}
